<?php include('header.php'); ?>

<div class="container grid">
	<?= get_sidebar(null, ['pagesize' =>8]) ?>

	<div>
		<h2>
			<a href="<?= get_category_link($category_id) ?>" title="<?= single_cat_title('', false) ?>">
				<?= single_cat_title('', false) ?>
			</a>
		</h2>
		<section class="grid imgnews">
			<?php
			$data = get_latest_posts_by_category(pageSize:20);
			foreach ($data['posts'] as $post) {
			?>
				<a href="<?= $post['link'] ?>" title="<?= $post['title'] ?>">
					<img src="<?= $post['thumbnail'] ?>" alt="<?= $post['title'] ?>">
					<section class="grid pd">
						<h3 class="nowrap2"><?= $post['title'] ?></h3>
						<span><?= $post['date'] ?> </span>
						<p><?= $post['excerpt'] ?></p>
					</section>
				</a>
			<?php
			}
			?>
		</section>

		<div class="pagelist">
			<?php
			echo paginate_links(array(
				'total' => $data['pagination']['total_pages'],
				'current' => $data['pagination']['current_page'],
				'prev_text' => __('«'),
				'next_text' => __('»'),
			));
			?>

		</div>

	</div>
</div>



<?php include('footer.php'); ?>